using System.Data;
using DataScripter.Scripting.Compare.DataTables.Data;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DataScripter.UnitTests.Comparison.DataTables.Data
{
    [TestClass]
    public class WhenTable1HasAnExtraRowInTheMiddle
    {
        private readonly DataTableDataComparisonResult _comparisonResult;

        public WhenTable1HasAnExtraRowInTheMiddle()
        {
            DataTable table1 = DataTableFactory.CreateDataTable();
            DataTable table2 = DataTableFactory.CreateDataTable();
            table1.Rows.Add(5, "xyz");

            DataTableDataComparer comparer = new DataTableDataComparer(table1, table2);
            _comparisonResult = comparer.Compare();
        }

        [TestMethod]
        public void ResultShouldNotBeOk()
        {
            Assert.IsFalse(_comparisonResult.AllRowsAreTheSame());
        }

        [TestMethod]
        public void NumberOfDifferencesShouldBe1()
        {
            Assert.AreEqual(1, _comparisonResult.NumberOfDifferences);
        }

        [TestMethod]
        public void RowToInsertShouldExist()
        {
            Assert.AreEqual(1, _comparisonResult.RowsToInsert.Count);
        }
    }
}